﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WorkflowWizart.Lib.Entities
{
    public class ListDataRow
    {
        public List<object> RowData { get; set; }
        public string Id { get; set; }
        public DateTime CreateDate { get; set; }
        public short Status { get; set; }
        public ListData ParentList { get; set; }

        public object this[int index]
        {
            get { return RowData[index]; }
            set { RowData[index] = value; }
        }

        public object this[string index]
        {
            get
            {
                for (int i = 0; i < ParentList.Columns.Count; i++)
                {
                    if (ParentList.Columns[i].Id == index)
                    {
                        return RowData[i];
                    }
                }
                return null;
            }
            set {

                for (int i = 0; i < ParentList.Columns.Count; i++)
                {
                    if (ParentList.Columns[i].Id == index)
                    {
                          RowData[i]=value;
                    }
                }
            }
        }
    }
}
